cmake_minimum_required(VERSION 2.8)

set(net_src 	dllmain.cpp
		dnsimpl.cpp
		dns.cpp
		dns_parser.cpp)
					
	
if (${UNIX_OS})
	include_directories(
		${PROJECT_SOURCE_DIR}/include
		${PROJECT_SOURCE_DIR}//extensions/include
		${by3rd_library_include}
		/usr/local/include
		/opt/local/include
		/usr/include
		/opt/include
		)
elseif (${WIN_OS})

else()

endif()


link_directories(/opt/local/lib)
link_directories(/opt/lib)
link_directories(${PROJECT_SOURCE_DIR}/lib//${CMAKE_BUILD_TYPE}/)
link_directories(/usr/lib/x86_64-linux-gnu)


set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE})

add_library(net SHARED ${net_src})

set_target_properties(net PROPERTIES OUTPUT_NAME "net")

set_target_properties(net PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -std=c++11 -fpermissive -fPIC -frtti -fexceptions")

if(CMAKE_BUILD_TYPE STREQUAL Debug)
	set_target_properties(net PROPERTIES COMPILE_FLAGS "-g3")
endif()

if(CMAKE_BUILD_TYPE STREQUAL Release)
	set_target_properties(net PROPERTIES COMPILE_FLAGS "-O3")
endif()



target_link_libraries(net dl)
target_link_libraries(net pthread)
target_link_libraries(net libevent.a)
target_link_libraries(net base)

install(TARGETS net 
	LIBRARY DESTINATION bin
	ARCHIVE DESTINATION bin)
